-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix invalid warning when $ROS_AUTOMATIC_DISCOVERY_RANGE is not defined #343
Conversation
PR missing one of the required labels: {'documentation', 'breaking-change', 'new feature', 'dependencies', 'bug', 'internal', 'enhancement'} |
Ok("SYSTEM_DEFAULT") => Some(RosAutomaticDiscoveryRange::SystemDefault), | ||
Ok(value) => { | ||
warn!( | ||
r#"Invalid value for environment variable ROS_AUTOMATIC_DISCOVERY_RANGE ("{value}"). Using "SUBNET" instead "# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we should have a warning here
According to here, we shouldn't change any discovery setting. I use Subnet
because I think our default configuration should be Subnet
.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to here, we shouldn't change any discovery setting
Reading this doc, the case of an invalid string is not specified. So we have 2 options:
- either panic, as we can't return an Error in this
default_automatic_discovery_range()
function - either ignoring the invalid value and use the default one which is
Subnet
according to the doc. I think it's also good to log a warning in this case to point the invalid value to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind. I missed the line Ok(value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. I found I misunderstood the changes
Following #311 , on Humble the following warning is logged when
$ROS_AUTOMATIC_DISCOVERY_RANGE
environment variable is not set:WARN tokio-runtime-worker ThreadId(09) zenoh_plugin_ros2dds: ROS_AUTOMATIC_DISCOVERY_RANGE will be ignored since it's not supported before ROS 2 Iron
The cause is Config::default_automatic_discovery_range() setting the value to
Some(RosAutomaticDiscoveryRange::Subnet)
if the environment variable is not defined.This PR fixes this.